var app = getApp();

Page({
    data: {
        _card_info: [],
        glo_is_load: !1,
        btn_disabled: !1,
        submitIsLoading: !1,
        yzm_btn_disabled: !0,
        showView: !1,
        gongkai: ""
    },
    open: function() {
        this.setData({
            condition: !this.data.condition
        });
    },
    onLoad: function(a) {
        var t = this;
        app.globalData.hasLogin ? t.setData({
            userInfo: app.globalData.userInfo
        }) : app.util.getUserInfo(function(a) {
            app.globalData.hasLogin = !0, t.setData({
                userInfo: a
            }), app.globalData.userInfo = a;
        });
        var n = a.cardid;
        t.setData({
            cardId: n
        }), 0 < n && app.util.request({
            url: "entry/wxapp/GetCard",
            data: {
                m: "bbyscm_card",
                cardid: n
            },
            success: function(a) {
                0 == a.data.errno ? t.setData({
                    _card_info: a.data.data,
                    cardid: a.data.data.id,
                    gongkai: a.data.data.gongkai,
                    fenxiang: a.data.data.fenxiang,
                    harass: a.data.data.harass
                }) : t.setData({
                    avater: t.data.userInfo.memberInfo.avatar
                });
            }
        });
    },
    onShow: function() {
        var a = this.data.cardId;
        app.globalData.sysinfo.mobile_verify_status;
        this.setData({
            cardid: a
        });
    },
    radioChange: function(a) {
        this.setData({
            gongkai: a.detail.value
        });
    },
    radio2Change: function(a) {
        this.setData({
            fenxiang: a.detail.value
        });
    },
    radio3Change: function(a) {
        console.log(a.detail.value);
        this.setData({
            harass: a.detail.value
        });
    },
    postCard: function(a) {
        var t = this;
        t.setData({
            btn_disabled: !0,
            submitIsLoading: !0
        }), JSON.stringify(a.detail.value);
        var n = a.detail.formId, i = t.data.cardid, s = t.data.gongkai, o = t.data.fenxiang, e = t.data.harass;
        wx.showToast({
            title: "提交中...",
            icon: "loading",
            duration: 1e4
        }), app.util.request({
            url: "entry/wxapp/PostMyCardPrivacy",
            data: {
                m: "bbyscm_card",
                form_id: n,
                cardid: i,
                gongkai: s,
                fenxiang: o,
                harass: e
            },
            method: "POST",
            success: function(a) {
                0 == a.data.errno ? wx.showModal({
                    title: "提示",
                    content: "提交成功",
                    showCancel: !1,
                    success: function(a) {
                        wx.navigateBack();
                    }
                }) : wx.showModal({
                    title: "提示",
                    content: a.data.message,
                    showCancel: !1,
                    success: function(a) {
                        a.confirm;
                    }
                });
            },
            fail: function(a) {
                wx.showModal({
                    title: "提示",
                    content: a.data.message,
                    showCancel: !1,
                    success: function(a) {
                        a.confirm;
                    }
                });
            },
            complete: function() {
                wx.hideToast();
            }
        });
    }
});